﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;

namespace Communication.Model.configuration
{
    /// <summary>
    /// 网络通信总配置包
    /// </summary>
    [StructLayoutAttribute(LayoutKind.Sequential, Pack = 4)]
    //[Serializable]
    public struct ACQParametersConfig
    {
        /// <summary>
        /// 下位机IP
        /// </summary>
        [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)]
        public byte[] IPAddress;        
                           
        /// <summary>
        /// 下位机端口号
        /// </summary>
        public long ClientPortNum;

        /// <summary>
        /// 采样方式   no use
        /// </summary>
        public UInt32 AcquisitionType;

        /// <summary>
        /// 界面刷新  值：(1/2/3/4/5)秒  
        /// </summary>
        public UInt32 UIRefreshFrequency;
        /// <summary>
        /// 系统调试 //0:不选中；1：选中调试模式；
        /// </summary>
        public UInt32 SystemDebug;
        /// <summary>
        /// 本地存储       0：开始存储，1：关闭
        /// </summary>
        public UInt32 LocalSave;
        // xxxxx
        /// <summary>
        /// 小时库     值：2/4/6/8/10/15秒
        /// </summary>
        public UInt32 HourDBInterval;
        // xxxxx 
        /// <summary>
        /// 天库        值：1/2/3/4/5分钟
        /// </summary>
        public UInt32 DayDBInterval;
        // xxxxx
        /// <summary>
        /// 周库       值：7/14/21/28/35分钟
        /// </summary>
        public UInt32 WeekDBInterval;
        // xxxxx
        /// <summary>
        /// 月库      值：30/60/90/120/150分钟 xxxxx
        /// </summary>
        public UInt32 MonthDBInterval;
        /// <summary>
        /// 年库      值：6/12/18/24/30小时
        /// </summary>
        public UInt32 YearDBInterval;

        /// <summary>
        /// 变负荷库
        /// </summary>
        public UInt32 VariableLoadDB;

        /// <summary>
        /// 升数据库
        /// </summary>
        public UInt32 StartSpeed;

        /// <summary>
        /// 降数据库
        /// </summary>
        public UInt32 StopSpeed;
        //      xxxxx
        /// <summary>
        /// 黑匣子事件前
        /// </summary>
        public UInt32 BlackboxBeforeEvent;

        /// <summary>
        /// 黑匣子事件后
        /// </summary>
        public UInt32 BlackboxAfterEvent;
        /// <summary>
        /// 黑匣子转速上限
        /// </summary>
        public UInt32 BlackBoxSUpLimit;
        /// <summary>
        /// 黑匣子转速下限
        /// </summary>
        public UInt32 BlackBoxSDownLimit;

        /// <summary>
        /// 黑匣子保存频率
        /// </summary>
        public UInt32 BlackBoxSavFre;

        /// <summary>
        /// 驱动软件版本
        /// </summary>
        public byte VerDriver;

        /// <summary>
        /// 系统软件版本
        /// </summary>
        public byte VerSysSoftware;

        /// <summary>
        /// FPGA软件主版本
        /// </summary>
        public UInt16 VerFPGAMain;

        /// <summary>
        /// FPGA采集卡版本
        /// </summary>
        public UInt16 VerFPGACollect;

        /// <summary>
        /// 测点配置，最多32个测点
        /// </summary>
        [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
        public TestPoint[] TestPoint_Data;

        /// <summary>
        /// 三相加速度测点
        /// </summary>
        [MarshalAs(UnmanagedType.ByValArray, SizeConst = 10)]
        public TriAccTestPointCon[] TriAccTestPointConfig_Data;        

        /// <summary>
        /// 转速配置，最多6个转速值
        /// </summary>
        [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)]
        public SpeedConfig[] SpeedConfigt_Data;

        //转速配置，最多6个转速值
        /// <summary>
        /// 通道配置
        /// </summary>
        [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)]
        public ChannelConfig[] ChannelConfig_Data;					     
    }
}
